#pragma once
#include <cstddef>
#include <memory>

namespace Cache
{

template<typename K, typename V>
class ArcNode
{
private:
    K _key;
    V _value;
    size_t _accessCount;
    std::weak_ptr<ArcNode> _prev;
    std::shared_ptr<ArcNode> _next;

public:
    ArcNode() :_accessCount(1), _next(nullptr) {}

    ArcNode(const K& key, const V& value)
        :_key(key),
         _value(value),
         _accessCount(1),
         _next(nullptr)
    {}

    K getKey() const { return _key; }
    V getValue() const { return _value; }
    size_t getAccessCount() const { return _accessCount; }

    void setKey(const K& key) { _key = key; }
    void setValue(const V& value) { _value = value; }
    void inAccessCount() { ++_accessCount; }

    template<typename Key, typename Value> friend class LfuPart;
    template<typename Key, typename Value> friend class LruPart;
};

}



